.net SaveChanges vs update difference

87

.net SaveChanges vs update difference -

using (var context = new UserContext())
{
    // Query for the entity.
    var user = context.Users.Single(e => e.Name == "Arthur");

    // Entity is now tracked. Make a change to it.
    user.Email = "[email protected]";

    // EF will detect the change and update only the column that has changed.
    context.SaveChanges();
}

Comments

Submit
0 Comments